package _9992QianDuanKongZhiQi.controller;

import _9992QianDuanKongZhiQi.dispatcher.Dispatcher;

/**
 * @FrontController: 前端控制器
 * @author: ZBoHang
 * @time: 2021/9/18 11:08
 */
public class FrontController {
    private Dispatcher dispatcher;

    public FrontController() {
        this.dispatcher = new Dispatcher();
    }

    private boolean isAuth() {
        System.out.println("授权成功");
        return true;
    }

    private void trackRequest(String request) {
        System.out.println("记录请求");
    }

    public void dispatchRequest(String request) {
        trackRequest(request);
        if (isAuth()) {
            dispatcher.dispatcher(request);
        }
    }
}
